#ifndef TC_SECURITY_HPP
#define TC_SECURITY_HPP

/** \file Security.hpp
 * Declarations for the class template Security.
 *
 * (C) Copyright by Semih Cemiloglu
 * All rights reserved, see COPYRIGHT file for details.
 *
 * $Id: Security.hpp 110 2006-06-19 03:38:33Z semihc $
 *
 *
 */

#include "TA.hh"

namespace TC {


  /** 
   * Basic security. 
   * This class must not be instantiated but its derived 
   * classes should be used instead.
   */
  template <typename P = TAprice_t, typename V = TAvolume_t>
  class Security 
  {
  public:
    // TYPES
    typedef P Price_t;
    typedef V Volume_t;

    // ACCESSORS
    Price_t getOpn() const  { return m_Opn; }
    Price_t getHi()  const  { return m_Hi;  }
    Price_t getLo()  const  { return m_Lo;  }
    Price_t getCls() const  { return m_Cls; }
    Volume_t getVol() const { return m_Vol; }

    // MODIFIERS
    void setOpn(Price_t v)  { m_Opn = v; }
    void setHi(Price_t v)   { m_Hi  = v; }
    void setLo(Price_t v)   { m_Lo  = v; }
    void setCls(Price_t v)  { m_Cls = v; }
    void setVol(Volume_t v) { m_Vol = v; }


  protected:
    // CREATORS
    Security()
      : m_Opn(0), m_Hi(0), m_Lo(0), m_Cls(0), m_Vol(0) {}
    Security(Price_t opn, Price_t hi, Price_t lo, 
	     Price_t cls, Volume_t vol)
      : m_Opn(opn), m_Hi(hi), m_Lo(lo), m_Cls(cls), m_Vol(vol) {}
    ~Security() {}

    // MEMBERS
    Price_t m_Opn;  //!< Open
    Price_t m_Hi;   //!< High
    Price_t m_Lo;   //!< Low
    Price_t m_Cls;  //!< Close
    Volume_t m_Vol; //!< Volume

  }; // end class


  /**
   * Extended Security.
   * This class must not be instantiated but its derived
   * classes should be used instead.
   */
  template <typename P = TAprice_t, typename V = TAvolume_t>
  class ExtSecurity : public Security<P,V>
  {
  public:
    // TYPES
    typedef P Price_t;
    typedef V Volume_t;

    // ACCESSORS
    Price_t getOpi() const { return m_Opi; }
    Price_t getBid() const { return m_Bid; }
    Price_t getAsk() const { return m_Ask; }

    // MODIFIERS
    void setOpi(Price_t v) { m_Opi = v; }
    void setBid(Price_t v) { m_Bid = v; }
    void setAsk(Price_t v) { m_Ask = v; }

  protected:
    // CREATORS
    ExtSecurity() 
      : m_Opi(0), m_Bid(0), m_Ask(0) {}
    ExtSecurity(Price_t opn, Price_t hi, Price_t lo, 
		Price_t cls, Volume_t vol,
                Price_t opi, Price_t bid, Price_t ask)
      : Security<P,V>(opn, hi, lo, cls, vol), 
        m_Opi(opi), m_Bid(bid), m_Ask(ask) {}
    ~ExtSecurity() {}

    // MEMBERS
    Price_t m_Opi; //!< Open interest
    Price_t m_Bid; //!< Bid (What market maker pays)
    Price_t m_Ask; //!< Ask (What market maker accepts)

  }; // end class

                           

} // end namespace



#endif /* Include guard */ 
